package 链表.单链表;

/**
 * https://leetcode.cn/problems/reverse-linked-list/?envType=study-plan-v2&envId=top-100-liked
 *
 * https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484467&idx=1&sn=beb3ae89993b812eeaa6bbdeda63c494&scene=21#wechat_redirect
 */
public class _206_反转链表 {

    public ListNode reverseList(ListNode head) {
        if (head == null ||head.next == null) return head;
        ListNode last = reverseList(head.next);
        head.next.next= head;
        head.next = null;
        return last;
    }
}
